package conf

import (
	"github.com/spf13/viper"
	"go.uber.org/zap"
)

// CosSection map toml [cos]
type CosSection struct {
	SecretID     string `mapstructure:"secret_id"`
	SecretKey    string `mapstructure:"secret_key"`
	BgpBucketURI string `mapstructure:"bgp_bucket_uri"`
	BgpURI       string `mapstructure:"bgp_uri"`
}

// ReadCos get qiniu section from config
func ReadCos(v *viper.Viper, slog *zap.SugaredLogger) (cosSection CosSection) {
	err := v.Unmarshal(&cosSection)
	if err != nil {
		slog.Panicf("unable to decode into cos section, %v", err)
	}
	slog.Debug(cosSection)
	return
}
